<?php
namespace app\admin\controller;
use app\common\lib\Util;
use app\common\lib\redis\Predis;

class Live
{
    public function push()
    {
        if(empty($_GET)){
            return Util::show('-1001','数据为空');
        }
        $teams=[
            1 => [
                'name' => '马刺',
                'logo' => '/live/imgs/team1.png',
            ],
            4 => [
                'name' => '火箭',
                'logo' => '/live/imgs/team2.png',
            ],
        ];
        $data = [
            'type' => intval($_GET['type']),
            'time' => date('H:i:s',time()),
            'title' => !empty($teams[$_GET['team_id']]['name']) ?$teams[$_GET['team_id']]['name'] : '直播员(bear)',
            'logo' => !empty($teams[$_GET['team_id']]['logo']) ?$teams[$_GET['team_id']]['logo'] : '',
            'content' => !empty($_GET['content']) ? $_GET['content'] : '',
            'image' => !empty($_GET['image']) ? $_GET['image'] : '',
        ];
        //数据组织好，放到task任务里
        $taskData=[
            'method'=>'pushLive',
            'data'=>$data,
        ];
        $_POST['http_server']->task($taskData);
        return Util::show('1','ok');
    }

}
